const HtmlWebpackPlugin = require('html-webpack-plugin')

let config = Object.assign({
    inject: true,
}, process.env.NODE_ENV === 'production' ? {
    minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeAttributeQuotes: true
    },
    chunksSortMode: 'dependency'
} : {})

exports.entry = {
    begin: './src/pages/activity/index.js',
    rule:'./src/pages/activity2/index.js',
    demo:'./src/pages/activity3/index.js',
    getVoucher:'./src/pages/activity4/index.js',
    shareHome:'./src/pages/activity5/index.js',
    ranking:'./src/pages/activity6/index.js'
}
exports.html = [
    {
        filename: 'begin.html',
        template: './src/pages/activity/index.html',
        chunks:['manifest','begin']
    },
    {
        filename: 'rule.html',
        template: './src/pages/activity2/index.html',
        chunks:['manifest','rule']
    },
    {
        filename: 'demo.html',
        template: './src/pages/activity3/index.html',
        chunks:['manifest','demo']
    },
    {
        filename: 'getVoucher.html',
        template: './src/pages/activity4/index.html',
        chunks:['manifest','getVoucher']
    },
    {
        filename: 'shareHome.html',
        template: './src/pages/activity5/index.html',
        chunks:['manifest','shareHome']
    },
    {
        filename: 'ranking.html',
        template: './src/pages/activity6/index.html',
        chunks:['manifest','ranking']
    }
].map(plugin => new HtmlWebpackPlugin(Object.assign(plugin, config)))